package Controllers;

import DB.DBCar;
import Models.Car;
import java.util.ArrayList;

public class CarController implements ControllerInterface<Car>
{ 
	public CarController ()
	{}

	public int insert(Car car)
	{
		DBCar dbc = new DBCar();
		return dbc.insert(car.exportData());
	}

	public void insertDependent(ArrayList<? extends DB.RowInterface> data)
	{}

	public Car find(int id)
	{
		DBCar dbc = new DBCar();
		return dbc.fetchByNo(id);
	}

	public int update(Car car, String where)
	{
		DBCar dbc = new DBCar();
		return dbc.update(car.exportData(), where);
	}

	public void updateDependent(ArrayList<? extends DB.RowInterface> data, String where)
	{}

	public int delete(int id)
	{
		DBCar dbc = new DBCar();
		return dbc.deleteByNo(id);
	}

	public ArrayList<Car> fetchAll()
	{
		DBCar dbc = new DBCar();
		return dbc.fetchAll();
	}
}